<?php
include_once($_SERVER['DOCUMENT_ROOT'] . '/smartrfid/model/item.php');
include_once($_SERVER['DOCUMENT_ROOT'] . '/smartrfid/dto/itemdto.php');
error_reporting(0);

$limit = $_GET['limit'];
$skip = $_GET['skip'];
$orderBy = $_GET['orderBy'];
$filters = $_GET['filters'];
$rfid = $_GET['rfids'];
$identifier = $_GET['identifiers'];

$t=new Item();

if($rfid) {
  $item = $t->loadByRfid($rfid);
  echo json_encode(new Itemdto($item));
} else if($identifier) {
  $item = $t->loadByIdentifier($identifier);
  echo json_encode(new Itemdto($item));
} else {
  $items = $t->loadByLimit($limit);
  $list=array();
  foreach($items as $item) {
    array_push($list, new Itemdto($item));
  }
  echo json_encode($list);
}



?>
